package cn.mogugo.joke.tld;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.hibernate.util.StringHelper;

public class JokePageStrTld extends BodyTagSupport {
	
	public int doEndTag() throws JspException {
		Object objPageStr = (Object)pageContext.getAttribute("pageStr");
		if(objPageStr != null){
			String[] pageStr = (String[])objPageStr;
			
			BodyContent bc = getBodyContent();
			String body = bc.getString();
			body = StringHelper.replace(body, "$_jo_pagestr_str0" , pageStr[0]);
			body = StringHelper.replace(body, "$_jo_pagestr_str1" , pageStr[1]);
			try {
	            pageContext.getOut().print(body);
	        } catch (IOException e) {
	        }
		}
		
		return (EVAL_PAGE);
	}
}